<%@ page language="java"
		 pageEncoding="UTF-8"%>
	<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<base href="<%=basePath%>">
<title>材料使用</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!-- 引用新样式 start -->
<jsp:include page="../../jsp/public.jsp" flush="true"/>
<!-- end -->
<script>
//提交表单
function queryMeterGivelList(){
	 var data=$("#queryForm").serialize();
		window.location.href="<%=path%>/bus/meter/meterGiveListTwo?"+data;
}

//跳转到材料使用详细页面
function toMeterUseView(modelCode){
	  window.location.href="<%=path%>/bus/meter/toMeterUseViewTwo?modelCode="+modelCode+"&status=1";
}
</script>
<body>
	<div class="col-lg-12">
				<div class="index-nav-right">
					<div class="index-nav-right-header"><span>当前位置 > 材料管理 > <b>材料使用台账</b></span></div>
				</div>
				<div class="right-table">
					<form id="queryForm" action="<%=path%>/bus/meter/meterGiveListTwo" method="post">
						<div class="search-form">

							<div class="search-form-input">
								<label>机种:</label>
								<select name="modelType" id="modelType">
									<option value="">请选择</option>
									<c:if test="${not empty mTypeList}">
										<c:forEach items="${mTypeList }" var="mTypeList"
												   varStatus="m">
											<option value="${mTypeList.targetName}"
													<c:if test="${map['modelType'] ==mTypeList.targetName }">selected</c:if>>${mTypeList.targetName}</option>
										</c:forEach>
									</c:if>
								</select>
							</div>

							<div class="search-form-input" style="border: 0px solid red">
								<label>难易度:</label>
								<select name="modelLevel" id="modelLevel">
									<option value="" <c:if test="${map['modelLevel'] =='' }">selected</c:if>>请选择</option>
									<option value="S" <c:if test="${map['modelLevel'] =='S' }">selected</c:if>>S</option>
									<option value="A" <c:if test="${map['modelLevel'] =='A' }">selected</c:if>>A</option>
									<option value="B" <c:if test="${map['modelLevel'] =='B' }">selected</c:if>>B</option>
									<option value="C" <c:if test="${map['modelLevel'] =='C' }">selected</c:if>>C</option>
								</select>
							</div>
								<div class="search-form-input">
	                                <label>部品番号</label><input type="text" name="modelCode" id="modelCode" 
	                                		value="${map['modelCode'] }" />
	                            </div>

							<div class="search-form-input">
								<label>厂家:</label>
								<select name="factory" id="factory" style="width:150px;">
									<c:if test="${not empty factory}">
										<option value=""></option>
										<c:forEach items="${factory }" var="factory" varStatus="m">
											<option value="${factory.orgName }"
													<c:if test="${map['factory'] ==factory.orgName }">selected</c:if>>${factory.orgName}</option>
										</c:forEach>
									</c:if>
								</select>
							</div>

                            <div class="search-form-btn search-form-input" style="border: 0px solid red;">
                                <button type="submit" class="btn btn-primary search-form-btn-s"  style="color: black;" >搜索</button>
                            </div>
                            
                           
                         </div>
                          </form>
                         <div class="index-table">
                         	<table class="table table-striped" action="<%=path%>/bus/meter/meterGiveListTwo">
                         		<thead>
									<tr class="table-thead">
										<th>序号</th>
										<th>厂家</th>
										<th>部品番号</th>
										<th>机种</th>
										<th>部品难易度</th>
										<!-- <th>用途</th> -->
										<th>材质</th>
										<th>板厚</th>
										<th>宽幅</th>
										<th>送长</th>


										<th>支给数量</th>
										<th>使用数量</th>
										<th>剩余数量</th>
										<th>可取台数</th>
										<th>操作</th>
									</tr>
								</thead>
								<tbody>
									<c:if test="${not empty list}">
										<c:forEach items="${list }" var="model" varStatus="r">
											<tr>	
												<td>${r.index+1 }</td>
												<td>${model.factory }</td>
												<td>${model.modelCode }</td>
												<td>${model.modelType }</td>
												<td>${model.modelLevel }</td>
												<%-- <td>${model.useFor }</td> --%>
												<td>${model.modelTexture }</td>
												<td>${model.tall }</td>
												<td>${model.wide }</td>
												<td>${model.grow }</td>


												<td>${model.giveAmount }</td>
												<td>${model.userAmount==null?0:model.userAmount }</td>
												<td>${model.giveAmount-model.userAmount }</td>
												<%--可取台数=剩余*每枚可取数--%>
												<td style="<c:if test="${model.perNum * (model.giveAmount-model.userAmount) < 200  }">color:red;</c:if>">${model.perNum * (model.giveAmount-model.userAmount)  }</td>

												<td id="${model.id }">
													<span  class="hand-like" onClick = "toMeterUseView('${model.modelCode }')">详细</span>
												</td>
											</tr>
										</c:forEach>
									</c:if>
									<c:if test="${empty list}">
										<tr>
											<td colspan="15"><label class="control-label text-center">无记录</label></td>
										</tr>
									</c:if>
								</tbody>
								<tr style="background: #f8f8f8">
									<td colspan="12"><jsp:include page="/WEB-INF/jsp/page2.jsp"></jsp:include></td>
								</tr>
                         	</table>
                         </div>
                     </div>
               </div>
               <input type="hidden" class="hiddenId" id ="modelPlanId" value="">
</body>
</html>